import React from 'react';
import PropTypes from 'prop-types';
import styles from './Classcard.css';
const Classcard = ({title, content, bgpic,ishead=1}) => {
  let titledom = typeof title === 'undefined' ? <div></div>:<div className={styles.title}>{title}</div>
  //let pricedom = typeof price === 'undefined' ? <div></div>:<div>{price}</div>
  let contentdom = typeof content === 'undefined' ? <span>{content}</span> : <div className={styles.content}>{content}</div>
  // eslint-disable-next-line
  let pic = typeof bgpic === 'undefined' ? '#fab1a0' : bgpic;
  const backgroundcss = {
  }
  if (ishead) {
    backgroundcss.backgroundColor = bgpic
  } else {
    backgroundcss.backgroundImage = `url(${bgpic})`
  }
  return (
    <div className = {styles.card} style={backgroundcss}>
        {titledom}
        {contentdom}
    </div>
  );
};

Classcard.propTypes = {
    title: PropTypes.string,
    content: PropTypes.string,
    price: PropTypes.number

};

export default Classcard;
